﻿using MaterialDesignDemo.UserControls;
using MaterialDesignDemo.ViewModel;
using MaterialDesignThemes.Wpf;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

namespace MaterialDesignDemo
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            var menuRegister = new List<SubItem>();
            menuRegister.Add(new SubItem("wpf控件", new WpfControl()));
            menuRegister.Add(new SubItem("控件", new ItemListControl()));
            menuRegister.Add(new SubItem("halcon", new HalconPage()));
            menuRegister.Add(new SubItem("列表", new GridViewPage()));
           

            var item1 = new ItemMenu("菜单", menuRegister, PackIconKind.Register);
            var menuRegister2 = new List<SubItem>();
            menuRegister2.Add(new SubItem("treeView", new AuthorityManagerPage()));
            var item2 = new ItemMenu("菜单2", menuRegister2, PackIconKind.People);

            Menu.Children.Add(new UserControlMenuItem(item1, this));
            Menu.Children.Add(new UserControlMenuItem(item2, this));
            //Menu.Children.Add(new UserControl1());
            //Menu.Children.Add(new UserControlMenuItem(item1, this));
            //Menu.Children.Add(new UserControlMenuItem(item2, this));
            //Menu.Children.Add(new UserControlMenuItem(item3, this));
            //Menu.Children.Add(new UserControlMenuItem(item4, this));
        }
        internal void SwitchScreen(object sender)
        {
            var screen = ((UserControl)sender);

            if (screen != null)
            {
                StackPanelMain.Children.Clear();
                StackPanelMain.Children.Add(screen);
            }
        }

        private void Image_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Process.GetCurrentProcess().Kill();
        }

        private void CanvasContainer_OnDragMove(object sender, MouseButtonEventArgs e)
        {
            switch (e.ClickCount)
            {
                case 1:
                    this.DragMove();
                    break;
            }
        }
    }
}